<span>

  <?php
    $link = connect_to_db('', 'admin_xbq', 'nihao', 'test');
    $sql = "select user_type from user where user.login='".$_SESSION['valid_login']."';";
    $result = mysql_query($sql) or die('Query failed1: ' . mysql_error());
    $line = mysql_fetch_array($result, MYSQL_ASSOC);
    
    if (isset($_GET['d_id']) &&  $_GET['d_id']!='') {
      //if its depart, show staff room and depart info
      echo "<table width=\"100%\"><tr><td class=\"style3\">";
      show_staffroom_list($_GET['d_id']);
      echo "</td><td class=\"style3\" align=\"right\">";
      depart_info($_GET['d_id']);
      echo "</td></tr></table>";
    }
    else {
      if (isset($_GET['s_id']) &&  $_GET['s_id']!= '') {
        //if its staff room...
        echo "<table width=\"100%\"><tr><td class=\"style3\">";
        show_teacher_list($_GET['s_id']);
        echo "</td><td class=\"style3\" align=\"right\">";
        staffroom_info($_GET['s_id']);
        echo "</td></tr></table>";
      }
      else {
        if (isset($_GET['user_id']) &&  $_GET['user_id']!= '') {
          //
          echo "<table width=\"100%\"><tr><td class=\"style3\"><table>";
          display_tree_for_rector($_GET['user_id']);
          echo "</table></td><td class=\"style3\" align=\"right\">";
          teacher_info($_GET['user_id']);
          echo "</td></tr></table>";
        }
        else {
          if (isset($_GET['f_id']) &&  $_GET['f_id']!= '') {
            download_file($_GET['f_id']);
            //file_info($_GET['f_id']);
          }
          else {
            if ($line['user_type'] == 'r') {
              show_depart_list();
            }
            else {
              if ($line['user_type'] == 'd') {
                $sql = "select depart_ID from staffroom where sr_ID=(select sr_ID from user where user.login='".$_SESSION['valid_login']."');";
                $result = mysql_query($sql) or die('Query failed2.1: ' . mysql_error());
                $line = mysql_fetch_array($result, MYSQL_ASSOC);
                show_staffroom_list($line['depart_ID']);
              }
              else {
                if ($line['user_type'] == 's') {
                  $sql = "select sr_ID from user where user.login='".$_SESSION['valid_login']."';";
                  $result = mysql_query($sql) or die('Query failed3: ' . mysql_error());
                  $line = mysql_fetch_array($result, MYSQL_ASSOC);
                  show_teacher_list($line['sr_ID']);
                }
              }
            }
          }
        }
      }
    }
  ?>
</span>
